import Config from '../config/config'
import { DefaultDataModel, FlatDataModel } from '../model/index'

// 获取用户信息
function getInfo(req, res) {
  const resData = FlatDataModel({
    permissions: ['*:*:*'],
    roles: ['admin'],
    user: {
      admin: true,
      avatar: '',
      businessName: '广汽研究院',
      createBy: 'admin',
      createTime: '2021-02-02 15:27:28',
      delFlag: '0',
      dept: null,
      deptName: '103',
      email: 'ry@163.com',
      loginDate: null,
      loginIp: '127.0.0.1',
      mCreateTime: null,
      mUpdateTime: null,
      mcreateTime: null,
      mupdateTime: null,
      nickName: '若依',
      params: {},
      password: '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2',
      phonenumber: '15888888888',
      postIds: null,
      postName: null,
      remark: '管理员',
      roleIds: null,
      roles: null,
      salt: null,
      searchValue: null,
      sex: '1',
      status: '0',
      tenantId: '1',
      updateBy: '',
      updateTime: null,
      userExtension: null,
      userId: 1,
      userName: 'admin',
      userType: 0
    }
  })
  res.json(resData)
}

// 获取路由信息
function getRouters(req, res) {
  const resData = {
    msg: '操作成功',
    code: 200,
    data: [
      {
        path: 'design',
        hidden: false,
        redirect: 'noRedirect',
        alwaysShow: true,
        meta: { title: '产品设计系统', titleAbbr: '设计', icon: 'form', noCache: false, isFrame: 1 },
        menuType: 'S',
        children: [
          {
            path: 'product',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '产品管理', titleAbbr: null, icon: 'vehicle', noCache: false, isFrame: 1 },
            menuType: 'M',
            children: [
              { name: 'ProductCategory', path: 'productCategory', hidden: false, meta: { title: '产品分类管理', titleAbbr: null, icon: null, noCache: false, isFrame: 1 }, menuType: 'C' },
              {
                name: 'Design',
                path: 'design',
                hidden: false,
                redirect: 'noRedirect',
                alwaysShow: true,
                meta: { title: '产品管理', titleAbbr: null, icon: null, noCache: true, isFrame: 1 },
                menuType: 'C',
                children: [{ name: 'DesignDetail', path: 'designDetail', hidden: true, meta: { title: '产品设计详细', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }]
              }
            ]
          },
          {
            path: 'scene-lib',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '场景管理', titleAbbr: null, icon: 'clipboard', noCache: false, isFrame: 1 },
            menuType: 'M',
            children: [
              {
                name: 'Scene',
                path: 'scene',
                hidden: false,
                redirect: 'noRedirect',
                alwaysShow: true,
                meta: { title: '场景模板', titleAbbr: null, icon: null, noCache: false, isFrame: 1 },
                menuType: 'C',
                children: [{ name: 'SceneNewAtomic', path: 'sceneNewAtomic', hidden: true, meta: { title: '新建原子场景', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }]
              },
              { name: 'SceneClassification', path: 'sceneClassification', hidden: false, meta: { title: '场景分类管理', titleAbbr: null, icon: null, noCache: false, isFrame: 1 }, menuType: 'C' },
              { name: 'SignalList', path: 'signalList', hidden: false, meta: { title: '信号管理', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' },
              {
                name: 'AntiShake',
                path: 'antiShake',
                hidden: true,
                redirect: 'noRedirect',
                alwaysShow: true,
                meta: { title: '防抖管理', titleAbbr: null, icon: null, noCache: true, isFrame: 1 },
                menuType: 'C',
                children: [{ name: 'AntiShakeNew', path: 'antiShakeNew', hidden: true, meta: { title: '防抖管理新建', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }]
              }
            ]
          },
          {
            path: 'service-lib',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '服务管理', titleAbbr: null, icon: 'color', noCache: false, isFrame: 1 },
            menuType: 'M',
            children: [
              {
                name: 'Service',
                path: 'service',
                hidden: false,
                redirect: 'noRedirect',
                alwaysShow: true,
                meta: { title: '服务模板', titleAbbr: null, icon: null, noCache: true, isFrame: 0 },
                menuType: 'C',
                children: [{ name: 'ServiceNew', path: 'serviceNew', hidden: true, meta: { title: '服务模板编辑页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }]
              },
              { name: 'ServiceClassification', path: 'serviceClassification', hidden: false, meta: { title: '服务分类管理', titleAbbr: null, icon: null, noCache: false, isFrame: 1 }, menuType: 'C' },
              { name: 'ServiceManagement', path: 'serviceManagement', hidden: false, meta: { title: '服务管理', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }
            ]
          },
          {
            name: 'Interactive',
            path: 'interactive',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '交互管理', titleAbbr: null, icon: 'dict', noCache: false, isFrame: 1 },
            menuType: 'C',
            children: [{ name: 'InteractiveNew', path: 'interactiveNew', hidden: true, meta: { title: '交互管理新增', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }]
          },
          {
            path: 'link',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '深层菜单测试', titleAbbr: null, icon: 'vehicle', noCache: false, isFrame: 1 },
            menuType: 'M',
            children: [
              {
                name: 'Test',
                path: 'test1',
                hidden: false,
                redirect: 'noRedirect',
                alwaysShow: true,
                meta: { title: '菜单1', titleAbbr: null, icon: null, noCache: true, isFrame: 1 },
                menuType: 'M',
                children: [
                  {
                    name: 'Test2',
                    path: 'test2',
                    hidden: false,
                    meta: { title: '菜单2菜单2菜单2菜单2菜单2', titleAbbr: null, icon: null, noCache: true, isFrame: 1 },
                    menuType: 'M',
                    children: [
                      {
                        name: 'Test3',
                        path: 'test3',
                        hidden: false,
                        meta: { title: '菜单3菜单3菜单3菜单3菜单3菜单3', titleAbbr: null, icon: null, noCache: true, isFrame: 1 },
                        menuType: 'C',
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        path: 'publish',
        hidden: false,
        redirect: 'noRedirect',
        alwaysShow: true,
        meta: { title: '产品发布系统', titleAbbr: '发布', icon: 'star', noCache: false, isFrame: 1 },
        menuType: 'S',
        children: [
          {
            name: 'Release',
            path: 'release',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '产品管理', titleAbbr: null, icon: 'checkbox', noCache: false, isFrame: 1 },
            menuType: 'C',
            children: [
              { name: 'ReleaseDetail', path: 'releaseDetail', hidden: true, meta: { title: '查看详情', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' },
              { name: 'ReleaseVersionTask', path: 'releaseVersionTask', hidden: true, meta: { title: '上下线', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' },
              { name: 'ViewReleaseHistory', path: 'viewReleaseHistory', hidden: true, meta: { title: '查看历史页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' },
              { name: 'ProductOffShelves', path: 'productOffShelves', hidden: true, meta: { title: '产品下架页', titleAbbr: '产品下架', icon: null, noCache: false, isFrame: 1 }, menuType: 'C' },
              { name: 'VersionOnline', path: 'versionOnline', hidden: true, meta: { title: '版本上线页', titleAbbr: null, icon: null, noCache: false, isFrame: 1 }, menuType: 'C' },
              { name: 'VersionOffline', path: 'versionOffline', hidden: true, meta: { title: '版本下线页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }
            ]
          },
          {
            name: 'Task',
            path: 'task',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '任务管理', titleAbbr: null, icon: 'message', noCache: true, isFrame: 1 },
            menuType: 'C',
            children: [{ name: 'TaskDetail', path: 'taskDetail', hidden: true, meta: { title: '任务详情', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }]
          },
          {
            name: 'ReleaseHistory',
            path: 'releaseHistory',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '产品发布历史', titleAbbr: null, icon: 'eye-open', noCache: false, isFrame: 1 },
            menuType: 'C',
            children: [
              { name: 'ReleaseHistoryDetail', path: 'releaseHistoryDetail', hidden: true, meta: { title: '查看页', titleAbbr: null, icon: null, noCache: false, isFrame: 1 }, menuType: 'C' },
              { name: 'ReleaseHistoryEdit', path: 'releaseHistoryEdit', hidden: true, meta: { title: '编辑页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }
            ]
          }
        ]
      },
      {
        path: 'system',
        hidden: false,
        redirect: 'noRedirect',
        alwaysShow: true,
        meta: { title: '研发工作台', titleAbbr: '工作台', icon: 'dashboard', noCache: false, isFrame: 1 },
        menuType: 'S',
        children: [
          {
            name: 'User',
            path: 'user',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '用户管理', titleAbbr: null, icon: 'component', noCache: false, isFrame: 1 },
            menuType: 'C',
            children: [{ name: 'UserNew', path: 'userNew', hidden: true, meta: { title: '查看页面', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }]
          },
          { path: 'e', hidden: false, meta: { title: 'test', titleAbbr: null, icon: 'checkbox', noCache: false, isFrame: 1 }, menuType: 'C' },
          {
            name: 'Role',
            path: 'role',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '角色管理', titleAbbr: null, icon: 'qq', noCache: false, isFrame: 1 },
            menuType: 'C',
            children: [{ name: 'RoleNew', path: 'roleNew', hidden: true, meta: { title: '角色新增页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }]
          },
          {
            name: 'RolePlan',
            path: 'rolePlan',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '角色方案', titleAbbr: null, icon: null, noCache: true, isFrame: 1 },
            menuType: 'C',
            children: [{ name: 'RolePlanNew', path: 'roleplannew', hidden: true, meta: { title: '编辑页', titleAbbr: null, icon: null, noCache: false, isFrame: 1 }, menuType: 'C' }]
          },
          {
            name: 'Admin',
            path: 'admin',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '管理员管理', titleAbbr: null, icon: null, noCache: false, isFrame: 1 },
            menuType: 'C',
            children: [{ name: 'AdminEdit', path: 'adminEdit', hidden: true, meta: { title: '编辑页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }]
          },
          {
            name: 'ProjectManagement',
            path: 'projectManagement',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '项目管理', titleAbbr: null, icon: null, noCache: true, isFrame: 1 },
            menuType: 'C',
            children: [
              { name: 'ProjectEdit', path: 'projectEdit', hidden: true, meta: { title: '编辑页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' },
              { name: 'ProjectAddUser', path: 'projectAddUser', hidden: true, meta: { title: '新增页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }
            ]
          },
          {
            name: 'OrganizationManagement',
            path: 'organizationManagement',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '组织管理', titleAbbr: null, icon: null, noCache: false, isFrame: 1 },
            menuType: 'C',
            children: [{ name: 'OrganizationEdit', path: 'organizationEdit', hidden: true, meta: { title: '编辑页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }]
          },
          {
            name: 'FlowManagement',
            path: 'flowManagement',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '流程管理', titleAbbr: null, icon: null, noCache: false, isFrame: 1 },
            menuType: 'C',
            children: [
              { name: 'FlowListView', path: 'flowListView', hidden: true, meta: { title: '查看页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' },
              { name: 'ApprovalRole', path: 'approvalRole', hidden: true, meta: { title: '审核角色页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }
            ]
          },
          {
            name: 'ApprovalTask',
            path: 'approvalTask',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '审批任务', titleAbbr: null, icon: null, noCache: false, isFrame: 1 },
            menuType: 'C',
            children: [
              { name: 'ApprovalTaskView', path: 'approvalTaskView', hidden: true, meta: { title: '查看页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' },
              { name: 'ApprovalTaskApprove', path: 'approvalTaskApprove', hidden: true, meta: { title: '审批页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }
            ]
          },
          {
            name: 'ApprovalHistory',
            path: 'approvalHistory',
            hidden: false,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '审批历史', titleAbbr: null, icon: null, noCache: false, isFrame: 1 },
            menuType: 'C',
            children: [{ name: 'ApprovalHistoryView', path: 'approvalHistoryView', hidden: true, meta: { title: '查看页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }]
          },
          { name: 'Menu', path: 'menu', hidden: false, meta: { title: '菜单管理', titleAbbr: null, icon: 'druid', noCache: false, isFrame: 1 }, menuType: 'C' },
          {
            name: 'Dict',
            path: 'dict',
            hidden: true,
            redirect: 'noRedirect',
            alwaysShow: true,
            meta: { title: '字典管理', titleAbbr: null, icon: '', noCache: false, isFrame: 1 },
            menuType: 'C',
            children: [
              { name: 'DictData', path: 'dictData', hidden: true, meta: { title: '字典数据', titleAbbr: null, icon: null, noCache: false, isFrame: 1 }, menuType: 'C' },
              { name: 'DictNew', path: 'dictNew', hidden: true, meta: { title: '字典新增页', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }
            ]
          },
          { name: 'MyOA', path: 'leave', hidden: true, meta: { title: '我的OA', titleAbbr: null, icon: null, noCache: false, isFrame: 1 }, menuType: 'C' },
          { name: 'ActivitiDefinition', path: 'definition', hidden: true, meta: { title: '流程定义', titleAbbr: null, icon: null, noCache: false, isFrame: 1 }, menuType: 'C' },
          { name: 'ModelManagement', path: 'modelManagement', hidden: true, meta: { title: '车型管理', titleAbbr: null, icon: null, noCache: true, isFrame: 1 }, menuType: 'C' }
        ]
      }
    ]
  }

  res.json(resData)
}

const ResponseList = [
  {
    path: `${Config.baseURL}/system/user/getInfo`,
    method: 'get',
    fun: getInfo
  },
  {
    path: `${Config.baseURL}/system/menu/getRouters`,
    method: 'get',
    fun: getRouters
  }
]

export default ResponseList
